package com.qingcloud.fexecutor.base.pojo;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
 * 树节点定义
 *
 * @author yangfan
 * @date 2021/12/16 20:51
 */
@Data
public class TreeNode {

    @ApiModelProperty(value = "id", example = "1")
    protected String id;

    @ApiModelProperty(value = "value", example = "值")
    private String value;

    @ApiModelProperty("父级节点")
    protected String parentId;

    @ApiModelProperty("子节点")
    public List<TreeNode> children;


    @Override
    public boolean equals(Object o) {
        if (this == o){
            return true;
        }
        if (o == null || getClass() != o.getClass()){
            return false;
        }

        TreeNode treeNode = (TreeNode) o;

        return id != null ? id.equals(treeNode.id) : treeNode.id == null;
    }

    @Override
    public int hashCode() {
        return id != null ? id.hashCode() : 0;
    }
}
